# -*- coding: utf-8 -*-
"""
author:码同学 极光
date:2024/9/21
desc: 
sample: 
"""
import random

"""
控制台模拟猜数字，比如数字为66，一直猜到正确为止
"""
number = random.randint(1, 100)
print(number)
# 无限猜
while True:
    try:
        guess = int(input('请输入数字--'))
        if guess == number:
            print('猜对了')
            break
        else:
            if guess < number:
                print("数字猜小了.请继续")
            elif guess > number:
                print("数字猜大了.请继续")
    except Exception as es:
        print(f'输入数据有问题，请继续输入{es}')
